package com.hertz.alarm.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.hertz.alarm.entity.Team;
import com.hertz.alarm.service.TeamNbaService;
@Controller
@RequestMapping("/admin/nbateam")
public class TeamController extends BaseController{

	@Resource
	private TeamNbaService teamNbaService;
	@RequestMapping(value="",method=RequestMethod.GET)
	public @ResponseBody Team getTeamNba(@RequestParam(value = "id", required = true) Short id){
		Team team = teamNbaService.getTeam(id);
		return team;
	}
	
	@RequestMapping(value="/list",method=RequestMethod.GET)
	public ModelAndView list(HttpServletRequest request){
		List<Team> list = teamNbaService.findAll();
		Map<String, Object> dataMap = new HashMap<String,Object>();
		dataMap.put("teams", list);
		return returnModelAndView(dataMap, request);
	}
}
